﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibMinecraft.Server;
using LibMinecraft.Model;

namespace PartyCraftServer.Commands
{
    public class SmiteCommand : Command
    {
        public override bool RequiresOp
        {
            get { return true; }
        }

        public override string DefaultCommand
        {
            get { return "smite"; }
        }

        public override string Documentation
        {
            get { return "Summons a lightning bolt at the player's position.\nUsage: /smite [player]"; }
        }

        public override void ExecuteCommand(RemoteClient client, params string[] parameters)
        {
            if (parameters.Length != 1)
            {
                client.SendChat(ChatColor.Red + "Invalid parameters.  Use /smite [player]");
                return;
            }
            if (PartyCraft.Server.GetClient(parameters[0]) == null)
            {
                client.SendChat(ChatColor.Red + "That player isn't online.");
                return;
            }
            PartyCraft.Server.CreateLightning(PartyCraft.Server.GetClient(parameters[0]).PlayerEntity.Location);
        }
    }
}
